#!/bin/sh -e

if [ -n "$1" ] && [ -x "$1" ]; then
	QTPATH="$1"
	shift
else
	QTPATH="$ME/../../source.build/qt-copy"
fi

MYDIR=`dirname $0`
ME=`cd $MYDIR; pwd`

. $ME/../../environment-helper.sh

INCLUDE_PATHS="-I `pwd`/include -I $ME/include"
if [ `grep -c -- -isystem "$QTPATH/configure"` -gt 0 ]; then
	INCLUDE_PATHS="$INCLUDE_PATHS -isystem /opt/kde4-deps/include"
else
	INCLUDE_PATHS="$INCLUDE_PATHS -I /opt/kde4-deps/include"
fi


$QTPATH/configure \
	-prefix /opt/qt4 \
	$INCLUDE_PATHS \
	-L `pwd`/lib \
	-L $ME/lib \
	-L /usr/lib \
	-L /opt/kde4-deps/lib \
	\
	-confirm-license \
	-dbus-linked \
	-debug-and-release \
	-exceptions \
	-fast \
	-framework \
	-no-sql-ibase \
	-no-sql-mysql \
	-no-sql-odbc \
	-no-sql-psql \
	-no-sql-sqlite2 \
	-openssl \
	-optimized-qmake \
	-pch \
	-plugin-sql-sqlite \
	-qt-gif \
	-sdk /Developer/SDKs/MacOSX10.4u.sdk \
	-stl \
	-system-libjpeg \
	-system-libmng \
	-system-libpng \
	-system-libtiff \
	-system-zlib \
	-universal \
	"$@"

